package com.kun.demo02;


import org.junit.Test;

//不带参数的Lambda表达式
public class TestLambda01 {

    @Test
    public void test() {
        Solution_1 solution_1 = new Solution_1();
        solution_1.method();
    }

    //2. 内部类实现接口
    class Solution_2 implements LambdaInterface {

        public void method() {
            System.out.println("Hello Lambda!---->Solution_2");
        }
    }

    @Test
    public void test2() {
        Solution_2 solution_2 = new Solution_2();
        solution_2.method();
    }

    @Test
    public void test3() {
        class Solution_3 implements LambdaInterface {

            public void method() {
                System.out.println("Hello Lambda!---->Solution_3");
            }
        }
        Solution_3 solution_3 = new Solution_3();
        solution_3.method();
    }

    @Test
    public void test4() {
        LambdaInterface lambdaInterface = new LambdaInterface() {

            public void method() {
                System.out.println("Hello Lambda!---->Solution_4");
            }
        };
        lambdaInterface.method();
    }

    @Test
    public void test5() {
        LambdaInterface lambdaInterface = ()->{
            System.out.println("Hello Lambda!---->Solution_5");
        };
        lambdaInterface.method();
    }




}


//1. 外部类实现接口
class Solution_1 implements LambdaInterface {

    public void method() {
        System.out.println("Hello Lambda!---->Solution_1");
    }
}

interface LambdaInterface {
    void method();
}


